package com.dsteiner.gwt.cafeteriasophia.client;


import com.dsteiner.gwt.cafeteriasophia.client.controller.NavController;
import com.dsteiner.gwt.cafeteriasophia.client.model.NavModel;
import com.dsteiner.widgets.client.Widgets.ButtonExt;
import com.dsteiner.widgets.client.Widgets.HTMLExt;
import com.dsteiner.widgets.client.Widgets.LazyWidget;
import com.dsteiner.widgets.client.event.EventManagerImpl;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.Widget;

public class NavWidget extends LazyWidget {

	private NavController navController = new NavController();
	private final NavModel navModel;

	public NavWidget(NavModel navModel) {
		this.navModel = navModel;
		setStyleName("nav-widget");
	}

	@Override
	public Widget createContentWidget() {
		FlowPanel mainPanel = new FlowPanel();

		ButtonExt createShiftChangeButton = new ButtonExt("ingresar cambio de turno");
		HTMLExt historyLink = new HTMLExt("<a href=\"javascript:void(0);\">historial</a>");
		HTMLExt statisticLink = new HTMLExt("<a href=\"javascript:void(0);\">estadistica</a>");
		
		mainPanel.add(createShiftChangeButton);
		mainPanel.add(historyLink);
		mainPanel.add(statisticLink);
		
		navController.registerCreateShiftChangeButton(createShiftChangeButton);
		navController.registerHistoryLink(historyLink);
		navController.registerStatisticLink(statisticLink);
		navController.registerNavWidget(this);
		navController.registerNavModel(navModel);
		navController.registerEventManager(EventManagerImpl.getInstance());
		
		return mainPanel;
	}

}